package com.cddx.logistics.controller;

import com.cddx.logistics.domain.dto.CarStatisticsDTO;
import com.cddx.logistics.service.CarStatisticsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/statistics/car")
public class CarStatisticsController {

    @Autowired
    private CarStatisticsService carStatisticsService;

    @GetMapping("/monthly")
    public List<CarStatisticsDTO> getCarMonthlyStatistics(
            @RequestParam("year") int year,
            @RequestParam(value = "license", required = false) String license) {
        return carStatisticsService.getCarMonthlyStatistics(year, license);
    }
}